package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VoMapper {

    @Select("select\n" +
            "    shop `name`,\n" +
            "    sum(actualAmount) `value`\n" +
            "from orderinfo\n" +
            "group by shop")
    List<Vo> getList1();

    @Select("select sum(amount) from payment where status='支付成功'")
    Double getList2();

    @Select("select\n" +
            "    shop `name`,\n" +
            "    sum(actualAmount) `value`\n" +
            "from orderinfo\n" +
            "group by shop")
    List<Vo> getList3();

    @Select("select\n" +
            "    b.name,\n" +
            "    sum(o.actualAmount)`value`\n" +
            "from orderinfo o\n" +
            "left join payment p on o.id=p.orderinfoid\n" +
            "left join baseprovince b on b.id=p.baseprovinceid\n" +
            "where b.name is not null \n" +
            "group by b.name")
    List<Vo> getList4();
}
